package com.example.demo.mongo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created on 2019/9/13.
 *
 * @author Grak
 * @since 1.0
 */
@RestController
public class MongoTestController {

    @Autowired
    StudentRepository studentRepository;

    @GetMapping("/addMongo")
    public String addMongo(){
        Student student = new Student();
        student.setId(String.valueOf(System.currentTimeMillis() / 10000));
        student.setName(student.getId() + "OKK");
        studentRepository.save(student);
        return student.getName();
    }
}
